<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="../../css/public.css" media="all">
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<div class="layui-form layuimini-form">
    <div class="layui-form-item">
        <label class="layui-form-label required">用户名</label>
        <div class="layui-input-block">
            <input type="text" name="name" lay-verify="required" lay-reqtext="用户名不能为空" placeholder="请输入用户名"
                   value="${employeeInfo.name}"
                   class="layui-input">
            <tip>填写自己管理账号的名称。</tip>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required"></label>
        <div class="layui-input-block">
            <input type="hidden" name="id" lay-verify="required"
                   value="${employeeInfo.id}"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">性别</label>
        <div class="layui-input-block">
            <c:if test="${employeeInfo.sex=='男'}">
                <input type="radio" name="sex" value="男" title="男" checked=checked>
                <input type="radio" name="sex" value="女" title="女">
            </c:if>

            <c:if test="${employeeInfo.sex=='女'}">
                <input type="radio" name="sex" value="男" title="男">
                <input type="radio" name="sex" value="女" title="女" checked=checked>
            </c:if>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">密码</label>
        <div class="layui-input-block">
            <input type="text" name="passwrod" lay-verify="required" lay-reqtext="手机不能为空" placeholder="请输入手机"
                   value="${employeeInfo.passwrod}"
                   class="layui-input">
        </div>
    </div>


<div class="layui-form-item">
    <label class="layui-form-label">出生年月</label>
    <div class="layui-input-block">
        <input type="text" name="birthday" id="date1" placeholder="请输入出生年月" lay-verify="date"
               value="${employeeInfo.birthday}"
               placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
    </div>
</div>
<div class="layui-form-item layui-form-text">
    <label class="layui-form-label">城市
    </label>
    <div class="layui-input-block">
        <input type="text"   name="city" class="layui-input" value="${employeeInfo.city}" placeholder="请输入城市"/>
    </div>
</div>

<div class="layui-form-item">
    <label class="layui-form-label">角色</label>
    <div class="layui-input-block">
        <select name="roleName" lay-verify="required" lay-search="">
            <option value="">请选择</option>
            <c:if test="${employeeInfo.roleName=='1'}">
                <option value="1" selected="selected">超级用户</option>
                <option value="2">boss</option>
                <option value="3">Hr人事</option>
                <option value="4">员工</option>
            </c:if>
            <c:if test="${employeeInfo.roleName=='2'}">
                <option value="1">超级用户</option>
                <option value="2" selected="selected">boss</option>
                <option value="3">Hr人事</option>
                <option value="4">员工</option>
            </c:if>
            <c:if test="${employeeInfo.roleName=='3'}">
                <option value="1">超级用户</option>
                <option value="2">boss</option>
                <option value="3" selected="selected">Hr人事</option>
                <option value="4">员工</option>
            </c:if>
            <c:if test="${employeeInfo.roleName== '4'}">
                <option value="1">超级用户</option>
                <option value="2">boss</option>
                <option value="3">Hr人事</option>
                <option value="4" selected="selected">员工</option>
            </c:if>
        </select>
    </div>
</div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认修改</button>
        </div>
    </div>

</div>
<script src="../../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script>
    layui.use(['form'], function () {
        var form = layui.form,
            layer = layui.layer,
            laydate  =layui.laydate;
            $ = layui.$;

        //日期
        laydate.render({
            elem: '#date1'
        });

        //监听提交
        form.on('submit(saveBtn)', function (data) {

            var index = JSON.stringify(data.field);

            $.ajax({
                type: 'post',
                url: '<%=request.getContextPath()%>/upda/updateEplmo',
                data: index,
                contentType: 'application/json',
                success: function (msg) {
                    let code = msg.code;

                    if (code == 0) {

                        layer.msg("修改成功");
                        parent.location.reload();
                    } else {
                        layer.alert(data.msg, "错误提示");
                    }

                }


            })

        });

    });
</script>
</body>
</html>